package com.itheima.stock.controller;

import com.itheima.stock.pojo.SysLog;
import com.itheima.stock.service.LogService;
import com.itheima.stock.vo.req.LogReqVo;
import com.itheima.stock.vo.resp.PageResult;
import com.itheima.stock.vo.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: siwukun
 * @date: 2022/06/11
 * @description:
 */
@RestController
@RequestMapping("/api")
public class LogController {

    @Autowired
    private LogService logService;

    /**
     * 获取所有的日志信息
     * @param reqVo 请求参数
     * @return
     */
    @PostMapping("/logs")
    public R<PageResult<SysLog>> getAlllogs(@RequestBody LogReqVo reqVo){
        return logService.getAllLogs(reqVo);
    }

    /**
     * 批量删除日志信息
     * @param lid 日志id
     * @return
     */
    @DeleteMapping("/log")
    public R<String> deleteAllLogs(@RequestBody List<Long> lid){
        return logService.deleteAllLogs(lid);
    }
}
